package com.jzo2o.customer.controller.open;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jzo2o.customer.model.dto.request.InstitutionRegisterReqDTO;
import com.jzo2o.customer.service.IRegisterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * @author Liu
 */
//@RestController("openRegisterController")
@RequestMapping("/open/serve-provider")
@Api(tags = "白名单接口 - 服务人员或机构相关接口")
@Slf4j
public class RegisterController {
    @Resource
    private IRegisterService registerService;

    @PostMapping("/institution/register")
    @ApiOperation("机构人员注册接口")
    public void registerForInstitution(@RequestBody InstitutionRegisterReqDTO institutionRegisterReqDTO) throws JsonProcessingException {
        log.info("Received registration request body: {}", new ObjectMapper().writeValueAsString(institutionRegisterReqDTO));
        registerService.register(institutionRegisterReqDTO);
    }
}
